package com.cwd.arm.inter.controller;

import com.cwd.arm.application.service.write.facade.ProjectWriteService;
import com.cwd.arm.inter.util.VoToDtoUtil;
import com.cwd.arm.inter.vo.ResponseVo;
import com.cwd.arm.inter.vo.receivableAmountVo.ReceivePlanUpdateVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by yan on 21-11-20.
 */
@Api(value = "应收管理接口", description = "应收管理接口")
@RestController
@RequestMapping(value = "/receivePlan")
public class ReceivablePlanController {

    @Autowired
    private ProjectWriteService projectWriteService;

    @ApiOperation(value = "修改收款计划", notes = "修改收款计划")
    @Secured({"ROLE_PLAN_EDIT"})
    @PostMapping("")
    public ResponseVo<String> update(@RequestBody ReceivePlanUpdateVo updateVo) {
        // TODO: 21-12-26 给收款计划增加单独的备注
        projectWriteService.update(VoToDtoUtil.convertToDto(updateVo));
        return ResponseVo.<String>BUILDER().success();
    }

}
